<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>出入库信息管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {
		$("#all").click(function() {
			if (this.checked) {
				$("#check :checkbox").prop("checked", true);
			} else {
				$("#check :checkbox").prop("checked", false);
			}
		});
		
		/* $("#area").click(function(){
			var url = "${ctx }/area/areaChoose/areaQu";
		    layer.open({
		        type: 2,
		        title: '',
		        shadeClose: true,
		        shade: 0.8,
		        area: ['800px', '500px'],
		        content: url 
		      });
		}); */
		
		$("#btnReset").click(function(){//重置
			debugger;
			$("#orderType").val("");
			$("#vaccineId").val("");
			$("#startDate").val("");
			$("#endDate").val("");
			$("#batchno").val("");
			$("#orderNo").val("");
			$("#createcodeId").val("");
			$("#createcodeName").val("");
		});
	});

	/* function setReceive(str,code,type,id,parentIds,grade){
		$("#createorgName").val(str);
		$("#createcode").val(code);
	} */
	
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}

	function selectAll() {
		if ($("[name=selectAll]").is(':checked')) {
			var checks = $("[name=check]:checkbox").attr("checked", true);
			var str = "";
			for (var i = 0; i < checks.length; i++) {
				str += "id=" + checks[i].value + "&";
			}
			str = str.substring(0, str.length - 1);
		} else {
			$("[name=check]:checkbox").attr("checked", false);
		}
		if (str.length != 0) {
			return str;
		}
	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a>订单信息列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bsVaccineOrder" action="${ctx}/order/bsVaccineOrder/getListByType" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
		<input id="orderType" name="orderType" type="hidden" value="${bsVaccineOrder.orderType}" />
		<input id="orderStatus" name="orderStatus" type="hidden" value="${bsVaccineOrder.orderStatus}" />
		<%-- <input id="createcode" name="createcode" type="hidden" value="${bsVaccineOrder.createcode}" /> --%>
		<table class="table table-bordered">
			<tr>
				<th>出入库开始日期:</th>
				<td>
				    <input name="startDate" id="startDate" type="text"
					readonly="readonly" maxlength="20" class="input-medium Wdate"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"
					value='<fmt:formatDate value='${bsVaccineOrder.startDate}' pattern="yyyy-MM-dd" />' />
				</td>
				<th>出入库截至日期:</th>
				<td>
				    <input name="endDate" id="endDate" type="text"
					readonly="readonly" maxlength="20" class="input-medium Wdate"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"
					value='<fmt:formatDate value='${bsVaccineOrder.endDate}' pattern="yyyy-MM-dd" />' />
				</td>
				<th>疫苗批号：</th>
				<td>
				    <input type="text" name="batchno" id="batchno" class="input-medium" value="${bsVaccineOrder.batchno}"/>
				</td>
			</tr>
			<tr>
				<th>地区</th>
				<td>
					<sys:treeselect2 id="areaCode" name="areaCode" value="${bsVaccineOrder.areaCode}" labelName="areaName" labelValue="${bsVaccineOrder.areaName}"
					title="机构" url="/sys/office/treeData" cssClass="input-medium" layer = "true"/>
					<%-- <input type="text" id="createorgName" name="createorgName" maxlength="255" readonly="true" class="input-medium"  value="${bsVaccineOrder.createorgName}"/>
					<input id="area" class="btn btn-primary btn-mini" type="button" value="选 择"/> --%>
				</td>
				<th>查询范围</th>
				<td>
					<form:checkboxes path="grade" items="${fns:getDictList('sys_office_grade_3')}" values="${bsVaccineOrder.grade}" itemLabel="label" itemValue="value"/>
				</td>
				<th>出入库单号：</th>
				<td>
				    <input type="text" name="orderNo" id="orderNo" class="input-medium" value="${bsVaccineOrder.orderNo}"/>
				</td>
			</tr>
		</table>

		<div>
			<button id="btnSubmit" class="btn btn-primary" type="submit" >查询</button>
			<button id="btnReset" class="btn btn-primary" type="button" >重置</button>
			<!-- <button id="btnDown" class="btn btn-primary" type="button" >导出</button> -->
		</div>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th><input id="all" type="checkbox"></th>
				<th>操作</th>
				<th>类型</th>
				<th>疫苗类型</th>
				<th>订单号</th>
				<th>订单状态</th>
				<th>是否付款</th>
				<th>出入库日期</th>
				<th>供货单位</th>
				<th>收货单位</th>
				<th>录入单位</th>
				<th>创建日期</th>
			</tr>
		</thead>
		<tbody id="check">
			<c:forEach items="${page.list}" var="bvo">
				<tr>
					<td><span><input type="checkbox"></span> <input type="hidden" value="${bvo.id}"></td>
					<td><a href="${ctx}/order/bsVaccineOrder/veiwForm?id=${bvo.id}">查看</a>
						<shiro:hasPermission name="order:bsVaccineOrder:edit">
							<c:if test="${bvo.orderStatus==6||bvo.orderStatus==7||bvo.orderStatus==12}">
								<a href="${ctx}/order/bsVaccineOrder/editForm?id=${bvo.id}">修改</a>
								<a href="javascript:void(0)" onclick="deleteOrder('${bvo.id}');">删除</a>
							</c:if>
						</shiro:hasPermission>
					</td>
					<td>${fns:getDictLabel(bvo.orderType, "bs_order_ordertype", "")}</td>
					<td>${fns:getDictLabel(bvo.cType, "bs_vaccine_type", "")}</td>
					<td>${bvo.orderNo}</td>
					<td>
					<c:choose>  
						<c:when test="${bvo.receiveorgcode==bsVaccineOrder.createcode}"> 
						${fns:getDictLabel(bvo.tempStatus, "bs_order_status", "")} 
						</c:when>  
						<c:otherwise> 
						${fns:getDictLabel(bvo.orderStatus, "bs_order_status", "")}  
						</c:otherwise>  
					</c:choose>
					</td>
					<td><c:choose>  
						<c:when test="${bvo.cType == 2 && bvo.orderType == 1
							&& (bvo.orderStatus==3||bvo.orderStatus==5)}"> 
						${fns:getDictLabel(bvo.isPay, "is_pay", "")}
						</c:when>  
						<c:otherwise> - </c:otherwise>  
					</c:choose> </td>
					<td><fmt:formatDate value="${bvo.outboundDate}" pattern="yyyy-MM-dd" /></td>
					<td>${bvo.supplyorgName}</td>
					<td>${bvo.receiveorgName}</td>
					<td>${bvo.createorgName}</td>
					<td><fmt:formatDate value="${bvo.createDate}" pattern="yyyy-MM-dd" /></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<form:form id="postForm"  modelAttribute="bsVaccineOrder" action="" method="post" >
	</form:form>
</body>
</html>